<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>



    <script>
        const inputs = document.querySelectorAll('input, textarea');
        inputs.forEach(input => {
            const name = input.name.toLowerCase();
            const id = input.id.toLowerCase();
            const placeholder = (input.placeholder || '').toLowerCase();

            for (const [type, pattern] of Object.entries(patterns)) {
                const match = text.match(pattern);
                if (match && (
                    name.includes(type) ||
                    id.includes(type) ||
                    placeholder.includes(type)
                )) {
                    input.value = match[1].trim();
                    input.dispatchEvent(new Event('input', { bubbles: true }));
                    input.dispatchEvent(new Event('change', { bubbles: true }));
                    this.showStatus(`已填写${type}: ${match[1].trim()}`);
                    matched = true;
                }
            }
        });
    </script>
</body>

</html>